package com.ykt.controller;

import com.ykt.converter.GoodsCategoryConverter;
import com.ykt.model.GoodsCategory;
import com.ykt.service.GoodsCategoryService;
import com.ykt.vo.GoodsCategoryVo;
import com.ykt.vo.ResultVo;

import java.util.List;

/**
 * 商铺自定义分类
 *
 * @author long.hua
 * @version 1.0.0
 * @since 2016-04-17 15:28
 */
public class GoodsCategoryController extends BaseController{

    private GoodsCategoryService categoryService = enhance(GoodsCategoryService.class.getName(), GoodsCategoryService.class);


    public void find() {
        Integer shopId = getParaToInt("shopId", -1);

        List<GoodsCategory> categories = categoryService.findByShopId(shopId);

        List<GoodsCategoryVo> categoryVos = GoodsCategoryConverter.convert(categories);

        this.returnJson(ResultVo.success(categoryVos));
    }


}
